package com.main.tripplanner.clientservices;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.main.tripplanner.persistent.Country;
import com.main.tripplanner.persistent.CountryList;
import com.main.tripplanner.persistent.Dosage;
import com.main.tripplanner.service.CountryService;

@Service
public class CountryClientService {
	@Autowired
	private CountryService countryService;

	private static CountryClientService service = null;

	public CountryList getAllCountries(){
		CountryList countryList= new CountryList();
		List<Country> list = countryService.getAllCountries();
		countryList.setCountryList(list);
		return countryList;
	}

	public static CountryClientService getService() {
		if (service == null) {
			service = new CountryClientService();
			return service;
		}
		return null;
	}

	public String getResponse() {
		CountryList countries = getAllCountries();
		return countries.toJsonString(true);
	}
	
	public static void main(String[] args){
		Dosage dosage = new Dosage();
		dosage.setCulturePercentage(10);
		dosage.setExtremePercentage(10);
		dosage.setFamilyPercentage(15);
		dosage.setNightLifePercentage(20);
		dosage.setTrekkingPercentage(45);
		System.out.println(dosage.toJsonString(true));
		
	}
}
